Exercise: Check Sum

Let's learn how to check for a sum in a list.

Problem statement#

Implement the check_sum() function which takes in a list and an integer as input.

check_sum(list, num) returns True if the sum of any two numbers in the list is equal to num. If no such pair exists, return False.

svg viewer

Sample input#

([9, -3, 7, 11, 5], 18)

Sample output#

True

Implement the function check_sum() in the code tab below:


The solution to this exercise will be discussed in the next lesson.

Quiz 1!

Solution Review: Check Sum